<!DOCTYPE html>
<!-- 3、计算距离国庆节还有多少天？ -->
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/javascript">
		var date1 = new Date();
		var date2 = new Date('2019-10-01');
		var date = (date2.getTime() - date1.getTime()) / (24 * 60 * 60 * 1000);
		alert(parseInt(date)); // 打印得到的相差天数
	</script>

</body>
</html>